#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>

using namespace std;

int Func(int n)
{
	int sum = 0;

	while (n)
	{
		int x = n % 10;
		sum += x * x * x;
		n /= 10;
	}

	return sum;
}

int main()
{
	int n = 0;
	cin >> n;

	cout << (Func(n) == n) << endl;

	return 0;
}